local class = require "Core.middleclass"
local LuaBehaviour = require "Core.LuaBehaviour"

local LuaBehaviourTest = class("LuaBehaviourTest", LuaBehaviour)

--------------------------需要序列化的数据--------------------------
LuaBehaviourTest.colorValue = CS.UnityEngine.Color
LuaBehaviourTest.textCmp = CS.UnityEngine.UI.Text
LuaBehaviourTest.rectCmp = CS.UnityEngine.RectTransform
LuaBehaviourTest.stringColorList = CS.System.Collections.Generic.List(typeof(CS.StringAndColor))
LuaBehaviourTest.int32Value = CS.System.Int32
LuaBehaviourTest.DoubleValue = CS.System.Double
LuaBehaviourTest.boolValue = CS.System.Boolean
LuaBehaviourTest.vector3Value = CS.UnityEngine.Vector3
LuaBehaviourTest.season = CS.Season
LuaBehaviourTest.go = CS.UnityEngine.GameObject
--------------------------需要序列化的数据--------------------------
function LuaBehaviourTest:initialize()
    --LuaBehaviour的构造函数
    LuaBehaviour.initialize(self)
    --输出注入的对象
    for key, value in pairs(self) do
        print("key : "..key..", value : "..tostring(value))
    end

    self.updateTextTime = CS.UnityEngine.Time.time
    self.stringIndex = 0
    self.textCmp.text = self.stringColorList[1].s
    self.textCmp.color = self.stringColorList[1].c
end

function LuaBehaviourTest:OnEnable()
    print("OnEnable")
end

function LuaBehaviourTest:Update()
    if CS.UnityEngine.Time.time - self.updateTextTime > 3 then
        self.updateTextTime = CS.UnityEngine.Time.time
        self.stringIndex = (self.stringIndex + 1) % self.stringColorList.Count
        self.textCmp.text = self.stringColorList[self.stringIndex].s
        self.textCmp.color = self.stringColorList[self.stringIndex].c
    end
end
--[[
function LuaBehaviourTest:FixedUpdate()
    print("FixedUpdate")
end

function LuaBehaviourTest:LateUpdate()
    print("LateUpdate")
end
]]--

function LuaBehaviourTest:OnPointerClick(eventData)
    print("click pos : "..tostring(eventData.position))
end

function LuaBehaviourTest:OnDisable()
    print("OnDisable")
end

function LuaBehaviourTest:OnDestroy()
    print("OnDestroy")
end

return LuaBehaviourTest
